package pers.vic.upload.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;

import javax.annotation.Resource;

/**
 * 描述: 启动后
 * @author Vic.xu
 * @date 2022-09-15 9:10
 */
@Component
public class AfterRunner implements ApplicationRunner {

    private static final Logger LOGGER = LoggerFactory.getLogger(AfterRunner.class);

    @Resource
    private UploadProperties uploadProperties;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        Assert.hasText(uploadProperties.getFolder(), "必须先配置上传文件的文件夹");
        LOGGER.info("当前配置的附件上传位置为: {}", uploadProperties.getFolder());
        LOGGER.info("当前环境上传附件是否需要登录: {}", uploadProperties.isNeedLogin());
    }
}
